package com.songqi.common.core.validator;

import javax.validation.Constraint;
import javax.validation.Payload;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;

import static java.lang.annotation.ElementType.FIELD;
import static java.lang.annotation.RetentionPolicy.RUNTIME;

/**
 * @author songqi
 */
@Target({ElementType.PARAMETER, FIELD})
@Retention(RUNTIME)
@Documented
@Constraint(validatedBy = DateRegexValidator.class)
public @interface DateRegex {

    /**
     * @return the error message template
     */
    String message() default "日期时间格式错误";

    String format() default "yyyy-MM-dd HH:mm:ss";

    /**
     * @return the groups the constraint belongs to
     */
    Class<?>[] groups() default {};

    /**
     * @return the payload associated to the constraint
     */
    Class<? extends Payload>[] payload() default {};
}
